#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);


    listWidget=new QListWidget();
    // listWidget->addItem("天气");
    listWidget->addItem("室内");
    listWidget->addItem("相机");
    listWidget->addItem("相册");
    listWidget->setObjectName("listWidget");
    listWidget->setCurrentRow(0);

    QWidget *wheater=new QWidget();
    QWidget *music=new QWidget();
    home=new net(this);
    mycamera=new camera(this);
    myphoto=new photo(this);
    wheater->setObjectName("wheater");
    home->setObjectName("home");
    mycamera->setObjectName("mycamera");
    connect(mycamera,SIGNAL(photoupdate()),myphoto,SLOT(photoupdate()));
    stackWidget=new QStackedWidget();
    // stackWidget->addWidget(wheater);
    stackWidget->addWidget(home);
    stackWidget->addWidget(mycamera);
    stackWidget->addWidget(myphoto);
    stackWidget->setCurrentIndex(0);
    connect(listWidget,SIGNAL(currentRowChanged(int)),stackWidget,SLOT(setCurrentIndex(int)));

    HBox=new QHBoxLayout();
    HBox->addWidget(listWidget);
    HBox->addWidget(stackWidget);

    HBox->setStretchFactor(stackWidget, 10);
    HBox->setStretchFactor(listWidget, 1);

    this->setLayout(HBox);
}

Widget::~Widget()
{
    delete ui;
}

